--[[
    * Author:Dzlua
    * QQ:505544956
    * Time:2018/07/10
--]]
set_project("SurperDuilib")
set_version("1.0.0")
--set_warnings("all", "error")
set_languages("c99", "cxx11")
add_cxflags("/EHsc")

if is_mode("release") then
    set_symbols("hidden")
    set_optimize("fastest")
    set_strip("all")
    add_defines("NDEBUG")
    add_cxflags("-MD")
elseif is_mode("debug") then
    set_symbols("debug")
    set_optimize("none")
    add_defines("DEBUG","_DEBUG")
    add_cxflags("-MDd")
end

add_defines("_UNICODE","UNICODE")
add_defines("WIN32","_WINDOWS")

target("spdui")
    set_kind("shared")
    add_defines("UILIB_EXPORTS","_WINDLL")
    
    add_links("kernel32","user32","gdi32","winspool","comdlg32","advapi32","shell32","ole32","oleaut32","uuid","odbc32","odbccp32")

    add_includedirs("src","src/duilib","src/spdui")
    add_files("src/duilib/**.cpp","src/spdui/**.cpp")

    set_headerdir("out/inc/spdui")
    add_headers("src/duilib/(**.h)|StdAfx.h","src/duilib/(**.tlh)","src/spdui/(**.h)")
target_end()

target("lua4spdui")
    set_kind("shared")
    add_defines("LUA_SCRIPT_EXPORTS","_WINDLL")

    add_linkdirs("pkg/LuaPlus/lib","build")
    add_links("LuaPlus","spdui")

    add_deps("spdui")

    add_includedirs("src/script/lua","out/inc/spdui","out/inc","pkg/LuaPlus/inc")
    add_files("src/script/lua/**.cpp")

    set_headerdir("out/inc/lua4spdui")
    add_headers("src/script/lua/SDLuaScript.h")
    add_headers("src/script/lua/export.h")

target_end()

target("testlua")
    set_kind("binary")
    add_defines("_LUA4SPDUI","LUA4SPDUI")
    add_defines("SHARED","_SHARED")

    add_includedirs("out/inc")
    add_includedirs("demos")
    add_linkdirs("build")
    add_links("spdui","lua4spdui")
    add_deps("spdui","lua4spdui")

    add_includedirs("demos/testlua")
    add_files("demos/testlua/**.cpp")
target_end()

target("hello")
    set_kind("binary")
    add_defines("_LUA4SPDUI","LUA4SPDUI")
    add_defines("SHARED","_SHARED")

    add_includedirs("out/inc")
    add_includedirs("demos")
    add_linkdirs("build")
    add_links("spdui","lua4spdui")
    add_deps("spdui","lua4spdui")

    add_includedirs("demos/hello")
    add_files("demos/hello/**.cpp")
target_end()

target("sdtool")
    set_kind("binary")
    add_defines("_LUA4SPDUI","LUA4SPDUI")
    add_defines("SHARED","_SHARED")

    add_includedirs("out/inc")
    add_includedirs("demos")
    add_linkdirs("build")
    add_links("spdui","lua4spdui")
    add_deps("spdui","lua4spdui")

    add_includedirs("demos/sdtool")
    add_files("demos/sdtool/src/**.cpp")
target_end()
